// convex 和 clerk 当没有用户信息的时候无法重定向到登录页
// 解决方法https://stackoverflow.com/questions/78464249/convex-with-clerk-dont-redirect-me-to-the-login-page

import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";

const isProtectedRoute = createRouteMatcher(["/(.*)", "/"]);

export default clerkMiddleware((auth, req) => {
  if (isProtectedRoute(req)) auth().protect();
});

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};
